<template>
	<view class="container">
		<view style="text-align: center;">产品图片</view>
		<view class="avatar">
			<!-- 上传组件 -->
			<u-upload name="product_img" :maxCount="6" :fileList="filelist" width="100" height="100" />
		</view>
		<view class="content" v-if="info.soure=='hire'">
			<u-form labelPosition="left" :model="info"></u-form>
			<u-form-item label="商品品牌" borderBottom>
				<u-input v-model="info.brankname_text" disabled border="none" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="品牌系列" borderBottom>
				<u-input v-model="info.btypename_text" disabled border="none" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="商品名称" borderBottom>
				<u-input v-model="info.name" border="none" disabled inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="申请门店" borderBottom>
				<u-input v-model="info.store_text" border="none" disabled inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="审批状态" borderBottom>
				<u-input v-model="info.sproduct.status_text" disabled border="none" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="申请时间" borderBottom>
				<u-input v-model="info.createtime_text" disabled border="none" inputAlign="center"></u-input>
			</u-form-item>
		</view>
		<view class="content" v-else>
			<u-form labelPosition="left" :model="info"></u-form>
			<u-form-item label="商品品牌" borderBottom>
				<u-input v-model="info.brankname_text" disabled border="none" placholder="商品品牌暂时未知" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="申请门店" borderBottom>
				<u-input v-model="info.store_text" disabled border="none" placholder="申请的门店暂时未知" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="品牌系列" borderBottom>
				<u-input v-model="info.btypename_text" disabled border="none" placholder="品牌系列暂时未知" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="商品型号" borderBottom>
				<u-input v-model="info.code" border="none" disabled placholder="商品型号暂时未知" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="审批状态" borderBottom>
				<u-input v-model="info.sproduct.status_text" border="none" disabled placholder="审批状态暂时未知" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="表壳材质" borderBottom>
				<u-input v-model="info.bkcz" border="none" disabled placholder="表壳材质暂时未知" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="表带材质" borderBottom>
				<u-input v-model="info.code" border="none" disabled placholder="表带材质暂时未知" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="机芯类型" borderBottom>
				<u-input v-model="info.jxtype" border="none" disabled placholder="机芯类型暂时未知" inputAlign="center"></u-input>
			</u-form-item>
			<u-form-item label="出售价" borderBottom>
				<u-input v-model="info.price" border="none" disabled placholder="商品出售价暂时未知" inputAlign="center"></u-input>
			</u-form-item>
		
		</view>
		<u-toast ref="notice"></u-toast>

	</view>
</template>

<script>

export default {
	onLoad(options) {
		console.log(options)
		this.businessinfo = this.$u.business.check()

		this.id = options.id ? options.id : 0
		this.soure = options.soure ? options.soure : ""

		this.getinfo()
	},
	data() {
		return {
			info: [],
			id: 0,
			soure: "",
			businessinfo: {},
			filelist: []
		}
	},
	methods: {
		async getinfo() {
			let data = {
				busid: this.businessinfo.id,
				id: this.id,
				soure: this.soure
			}

			let result = await this.$u.api.product.releaseinfo(data)
			if (result.code) {
				this.info = result.data

				if(this.info.thumbs_text.length>0)
				{
					this.filelist = this.info.thumbs_text.map((item)=>{
						return {
							url:item
						}
					})
				}
			} else {
				this.$refs.notice.shadowRoot({
					type: "warning",
					message: result.msg,
					complete: () => {
						//返回上一个界面
						uni.$u.route({
							type: 'navigateBack',
							delta: 1
						})

						return
					}
				})
			}
		}


	}
}

</script>

<style lang="scss">
 .u-form-item__body__left__content__label.data-v-5e7216f1 {
	width: 75px;
} 
.container {
	height: 100%;
	margin: 0 50rpx;
	box-sizing: border-box;
}

.content {
	padding: 20px;
  }
  

.avatar {
	text-align: center;
}

.u-avatar {
	margin: 80rpx auto 40rpx;
}

.xcx {
	width: 200rpx;
	height: 200rpx;
	margin: 80rpx auto 40rpx;
	border-radius: 100%;
	overflow: hidden;
}

.nickname {
	font-size: 14px;
	text-align: center;
}

.title {
	text-align: center;
	margin: 40rpx 0;
	font-size: 14rpx;
}

.avatar .u-upload {
	justify-content: center;
	align-items: center;
	margin: 3em auto;
}
</style>
